package com.eian.boot.common.constants;

import java.time.temporal.ChronoUnit;

/**
 * 系统模块缓存常量配置
 *
 * @author alex.meng
 */
public interface CacheConstants {

    /**
     * 缓存Key前缀
     */
    interface Keys {
        String USER_PERMS = "user:perms:";
        String USER_ROLES = "user:roles:";
        String USER_MENUS = "user:menus:";
        String ROLE_PERMS = "role:perms:";
    }

    /**
     * 缓存过期时间配置
     */
    interface Expire {
        long USER_PERMS_TIME = 30;
        ChronoUnit USER_PERMS_UNIT = ChronoUnit.MINUTES;

        long USER_ROLES_TIME = 30;
        ChronoUnit USER_ROLES_UNIT = ChronoUnit.MINUTES;

        long USER_MENUS_TIME = 30;
        ChronoUnit USER_MENUS_UNIT = ChronoUnit.MINUTES;

        long ROLE_PERMS_TIME = 60;
        ChronoUnit ROLE_PERMS_UNIT = ChronoUnit.MINUTES;
    }

    /**
     * 缓存Key模式（用于批量删除）
     */
    interface Patterns {
        String USER_ALL = "user:*";
        String ROLE_ALL = "role:*";
    }
}
